using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class MerchantBaseInfoMap : EntityTypeConfiguration<MerchantBaseInfo>
	{
		public MerchantBaseInfoMap()
		{
			// Primary Key
			this.HasKey(t => t.ID);

			// Properties
			this.Property(t => t.ProvinceID)
				.IsRequired()
				.HasMaxLength(10);
				
			this.Property(t => t.CityID)
				.IsRequired()
				.HasMaxLength(10);
				
			this.Property(t => t.MerchantName)
				.HasMaxLength(100);
				
			this.Property(t => t.MerchantCode)
				.IsRequired()
				.HasMaxLength(50);
				
			this.Property(t => t.MerchantFullName)
				.HasMaxLength(100);
				
			this.Property(t => t.SimpleSpell)
				.HasMaxLength(50);
				
			this.Property(t => t.Address)
				.HasMaxLength(50);
				
			this.Property(t => t.Contacter)
				.HasMaxLength(50);
				
			this.Property(t => t.ContacterPhone)
				.HasMaxLength(50);
				
			this.Property(t => t.Telephone)
				.HasMaxLength(50);
				
			this.Property(t => t.Email)
				.HasMaxLength(100);
				
			// Table & Column Mappings
			this.ToTable("MerchantBaseInfo");
			this.Property(t => t.ID).HasColumnName("ID");
			this.Property(t => t.ProvinceID).HasColumnName("ProvinceID");
			this.Property(t => t.CityID).HasColumnName("CityID");
			this.Property(t => t.MerchantName).HasColumnName("MerchantName");
			this.Property(t => t.MerchantCode).HasColumnName("MerchantCode");
			this.Property(t => t.MerchantFullName).HasColumnName("MerchantFullName");
			this.Property(t => t.SimpleSpell).HasColumnName("SimpleSpell");
			this.Property(t => t.Address).HasColumnName("Address");
			this.Property(t => t.Contacter).HasColumnName("Contacter");
			this.Property(t => t.ContacterPhone).HasColumnName("ContacterPhone");
			this.Property(t => t.Telephone).HasColumnName("Telephone");
			this.Property(t => t.Email).HasColumnName("Email");
			this.Property(t => t.OrderPeak).HasColumnName("OrderPeak");
			this.Property(t => t.PickMode).HasColumnName("PickMode");
			this.Property(t => t.IsDeleted).HasColumnName("IsDeleted");
			this.Property(t => t.CreatBy).HasColumnName("CreatBy");
			this.Property(t => t.CreatTime).HasColumnName("CreatTime");
			this.Property(t => t.CreateStationID).HasColumnName("CreateStationID");
			this.Property(t => t.UpdateBy).HasColumnName("UpdateBy");
			this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
			this.Property(t => t.UpdateStationID).HasColumnName("UpdateStationID");
		}
	}
}

